import requests
import sys
import io
import time
import json
import base64

# 请求体
body = {"jbsks":"否","jbsfl":"否","jbsbs":"否","jbslt":"否","jbsyt":"否","jbsfx":"否","lxdh":"13388888888","xxdz":"重庆邮电大学","szdq":"重庆市,重庆市,南岸区","name":"刘锦源","xh":"2019214952","xb":"男","latitude":29.56471,"longitude":106.55073,"locationBig":"中国,重庆市,重庆市,渝中区","locationSmall":"重庆市渝中区人民支路96-4号","hjsfly":"否","ywjchblj":"无","ywjcqzbl":"无","xjzdywqzbl":"无","twsfzc":"是","ywytdzz":"无","brsfqz":"无","brsfys":"无","jbs":"无","beizhu":"备注无","sfyfy":"无","fyjtgj":"无","fyddsj":"无","sfbgsq":"无","sfjjgl":"无","jjglqssj":"无","wjjglmqqx":"无","qtycqk":"无","mrdkkey":"LepVGPHN","timestamp":time.time()}
# json格式 因为dist字典，map格式无法使用encode方法，，我们必须将这个转化为字符串
dataJson = json.dumps(body) 
print("json "+dataJson)
# utf编码
utf8_data=dataJson.encode('utf-8')
print(utf8_data)
# base64 加密
base64_data=base64.b64encode(utf8_data)
data = {"key":base64_data}
print("data ==>",data)

